module Fighter {
	/**
	 * 发射散弹的飞机子类---刘伟 
	 * */
	export class PlaneShot extends BasicFly {

		/**子弹层 */
		public bulletManager: Bullet.BulletManager;
		/**散弹角度 */
		public BulletAnglelist: number[] = [Math.PI / 6, Math.PI / 3, Math.PI / 2, Math.PI * 2 / 3, Math.PI * 5 / 6];
		/**发射计时 */
		public fire_time = new egret.Timer(1000, 0);


		/**飞机出生 */
		public born(point, tid) {
			super.born(point, tid);
			this.getBulletManager();
			this.fire_time.addEventListener(egret.TimerEvent.TIMER, this.creatBullet, this);
			this.fire_time.start();
		}
		/**飞机销毁 */
		public destroy() {
			super.destroy();
			this.fire_time.reset();
			this.fire_time.removeEventListener(egret.TimerEvent.TIMER, this.creatBullet, this);
		}


		/**关联子弹层 */
		public getBulletManager() {
			this.bulletManager = this.showPanle.BulletManager;
		}



		/**制造散弹 */
		protected creatBullet() {
			let point = new egret.Point(this.fly.x + this.fly.width/2, this.fly.y + this.fly.height);
			for (let i = 0; i < this.BulletAnglelist.length; i++) {
				this.bulletManager.createBullet(2, point, this.BulletAnglelist[i]);
			}
		}
	}
}